<div class="row">
    <div class="col-xs-12 col-md-12">
        <div class="widget">
            <div class="widget-header bg-blue">
                <i class="widget-icon fa fa-arrow-down"></i>
                <span class="widget-caption">管理员列表</span>
                <div class="widget-buttons">
                    <a href="#" data-toggle="maximize">
                        <i class="fa fa-expand"></i>
                    </a>
                    <a href="#" data-toggle="collapse">
                        <i class="fa fa-minus"></i>
                    </a>
                    <a href="#" data-toggle="dispose">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
            </div>

            <div class="widget-body">

                <div class="table-toolbar">

                    <a href="{:url('dlc/admin/adminAdd')}" class="btn btn-primary" data-loader="App-loader" data-loadername="新增角色">
                        <i class="fa fa-plus"></i>新增管理员
                    </a>

                    <a href="#" class="btn btn-danger" id="App-delall">
                        <i class="fa fa-delicious"></i>全部删除
                    </a>

                    <div class="pull-right">
                        <form id="App-search">
                            用户名：
                            <label style="margin-bottom: 0px;">
                                <input name="nickname" type="search" class="form-control input-sm" value="xxx" placeholder="用户名">
                            </label>  &nbsp;&nbsp;
                            手机号：
                            <label style="margin-bottom: 0px;">
                                <input name="mobile" type="text" class="form-control input-sm" value="xxxxx" placeholder="手机号">
                            </label> &nbsp;&nbsp;
                            帐号类型：
                            <label style="margin-bottom: 0px;">
                                <select name="user_type">
                                    <option value="">请选择</option>
                                    <option value="1" >小程序</option>
                                    <option value="2" >生活号</option>
                                </select>
                            </label>
                            <a href="{:url('/dlc/admin/adminList')}" class="btn btn-success" data-loader="App-loader" data-loadername="用户列表" data-search="App-search">
                                <i class="fa fa-search"></i>搜索
                            </a>
                        </form>
                    </div>
                </div>




                <table id="App-table" class="table table-bordered table-hover">
                    <thead class="bordered-darkorange">
                    <tr role="row">
                        <th width="30px">
                            <div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
                                <label style="padding-left: 4px;"> <input type="checkbox" class="App-checkall colored-blue">
                                    <span class="text"></span>
                                </label>
                            </div>
                        </th>
                        <th>ID</th>
                        <th>账号</th>
                        <th>角色</th>
                        <th>添加时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                        <tr id="item{$vo.id}">
                            <td><div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
                                <label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue App-check" value="{$vo.id}">
                                    <span class="text"></span>
                                </label>
                            </div>
                            </td>
                            <td class=" sorting_1">{$vo.id}</td>
                            <td class=" ">{$vo.username}</td>
                            <td class=" ">
                                {if condition="$vo['id'] eq 1"}
                                    <span style='color:darkred;'>超级管理员</span>
                                {else}
                                    {volist name="vo['roles']" id="role" empty="<span style='color:deeppink;'>暂时没有角色</span>"}
                                        {$role.name}
                                    {/volist}
                                {/if}
                            </td>
                            <td class=" ">{$vo.create_time|date="Y-m-d H:i:s"}</td>
                            <td class="center ">
                                {if condition="$vo['id'] neq 1"}
                                <a href="{:url('dlc/admin/adminEdit',['id'=>$vo['id']])}" class="btn btn-success btn-xs" data-loader="App-loader" data-loadername="编辑角色"><i class="fa fa-edit"></i>编辑</a>
                                &nbsp;&nbsp
                                <a href="{:url('dlc/admin/adminDel',['id'=>$vo['id']])}" class="btn btn-danger btn-xs" data-type = "del" data-ajax="{:url('dlc/admin/adminDel',array('id'=>$vo['id']))}"><i class="fa fa-trash-o"></i> 删除</a>
                                {/if}

                            </td>
                        </tr>
                    {/volist}
                    </tbody>
                </table>
                <div class="row DTTTFooter">
                    {$list|raw}
                </div>
            </div>
        </div>
    </div>
</div>
<!--面包屑导航封装-->

<script type="text/javascript">
    setBread($('#tmpbread').html());
</script>
<!--/面包屑导航封装-->
<!--全选特效封装/全部删除-->
<script type="text/javascript">
    //全选
    var checkall=$('#App-table .App-checkall');
    var checks=$('#App-table .App-check');
    var trs=$('#App-table tbody tr');
    $(checkall).on('click',function(){
        if($(this).is(":checked")){
            $(checks).prop("checked","checked");
        }else{
            $(checks).removeAttr("checked");
        }
    });
    $(trs).on('click',function(){
        var c=$(this).find("input[type=checkbox]");
        if($(c).is(":checked")){
            $(c).removeAttr("checked");
        }else{
            $(c).prop("checked","checked");
        }
    });
    //全删
    $('#App-delall').on('click',function(){
        var checks=$(".App-check:checked");
        var chk='';
        $(checks).each(function(){
            chk+=$(this).val()+',';
        });
        if(!chk){
            $.App.alert('danger','请选择要删除的项目！');
            return false;
        }
        var toajax="{:url('dlc/admin/adminDel')}"+"/id/"+chk;
        var funok=function(){
            var callok=function(){
                //成功删除后刷新
                $('#refresh-toggler').trigger('click');
                return false;
            };
            var callerr=function(){
                //拦截错误
                return false;
            };
            $.App.ajax('post',toajax,'nodata',callok,callerr);
        }
        $.App.confirm("确认要删除吗？",funok);
    });
</script>
<!--/全选特效封装-->